{extends file="insider_base.html"}

{block name=content}
<div class="home_message ">
    {$local.dummy=settype($data.message,'array')}
    <div class="notification {$data.type}">     
    {foreach $data.message as $msg}
    	<div>{$msg}</div>
    {/foreach}
    </div>
    
    <div class="redirect btn_count_{count($data.redirect)}">
    	{foreach $data.redirect as $title=>$url}
        {if !$url}{continue}{/if}        
    	<a class="redirect_selection" href="{$url}">{$title}</a>
        {/foreach}
    </div>
    {$auto=$data.auto}
    {if $auto&&$data.redirect}
    <div class="count_down">
    	系统将在<span id="count_down_count">{$auto}</span>秒后自动跳转到第一个链接 <a id="cancel_count_down" style="cursor:pointer;">取消自动跳转</a>
    </div>
    
    <script>
    	var left_seconds=parseInt('{$auto}');
    	function count_down(){
    		if(left_seconds<0){
    			window.location.href=$('a.redirect_selection').eq(0).attr('href');
    			return;
    		}
    		$('#count_down_count').html(left_seconds--);
    		count_down.timeout=window.setTimeout(count_down,1000);
    	}
    	$(document).ready(function(){ count_down(); });
    	$('#cancel_count_down').click(function(){
    		window.clearTimeout(count_down.timeout);
    		$(this).parent().remove();
    	})
    	
    </script>
    {/if}    
</div>
{/block}
